/**   
 * Copyright © 2016  All rights reserved.
 * 
 * @Title: AppNettyServer.java 
 * @Project: clusterntss
 * @Package: com.jndk.netty.json 
 * @Description: 请用一句话描述
 * @author: yuanzhenghe
 * @date: 2016年12月9日 下午3:12:24 
 * @version: V1.0   
 */
package com.jndk.netty.json;

/**
 * @ClassName: AppNettyServer
 * @Description: 请用一句话描述
 * @author: yuanzhenghe
 * @date: 2016年12月9日 下午3:12:24
 */
public class AppNettyServer {

	public static void main(String[] args) throws Exception {
		
		System.out.print("Hello Netty\r\n");

		int port = 9090;
		
		if (args != null && args.length > 0) {
			try {
				port = Integer.valueOf(args[0]);
			} catch (NumberFormatException e) {
				System.out.print("Invalid Port, Start Default Port: 9090");
			}
		}
		try {
			NettyCommandServer commandServer = new NettyCommandServer();
			System.out.print("Start listen socket, port " + port + "\r\n");
			commandServer.bind(port);
		} catch (Exception e) {
			System.out.print(e.getMessage());
		}
	}
}
